package com.tomecode.tools.maven.settings.model;

/**
 * 
 * In the above description of repositories, it was mentioned that they all
 * follow a common layout. This is mostly correct. Maven 2 has a default layout
 * for its repositories; however, Maven 1.x had a different layout. Use this
 * element to specify which if it is default or legacy.
 * 
 * @author Tomas Frastia
 * @see http://www.tomecode.com or
 *      http://code.google.com/p/maven-settings-editor/
 * 
 */
public enum Layout {

	EMPTY(""), DEFAULT("default"), LEGACY("legacy");

	private Layout(String name) {
		this.name = name;
	}

	private final String name;

	public final String toString() {
		return name;
	}

	public static final Layout parse(String layout) {
		if (layout == null || layout.trim().length() == 0) {
			return EMPTY;
		}
		for (Layout eLayout : values()) {
			if (eLayout.toString().equals(layout)) {
				return eLayout;
			}
		}
		return EMPTY;
	}
}
